<?php

	do_action( 'bp_before_profile_edit_content' );

	if ( bp_has_profile( 'profile_group_id=' . bp_get_current_profile_group_id() ) ) :

		while ( bp_profile_groups() ) : bp_the_profile_group(); ?>

			<form action="<?php bp_the_profile_group_edit_form_action(); ?>" method="post" id="profile-edit-form" class="standard-form <?php bp_the_profile_group_slug(); ?>">
			
				<?php do_action( 'bp_before_profile_field_content' ); ?>
			
					<ul class="no kul">
			
						<?php bp_profile_group_tabs(); ?>
			
					</ul>
			
					<div class="line clear"><!-- --></div>
					<div class="h20"><!-- --></div>

					<h4><?php printf( __( "Editing '%s' Profile Group", "buddypress" ), bp_get_the_profile_group_name() ); ?></h4>

					<?php

						while ( bp_profile_fields() ) : bp_the_profile_field(); ?>
			
							<div<?php bp_field_css_class( 'editfield' ) ?>>
				
								<?php

									if ( 'textbox' == bp_get_the_profile_field_type() ) : ?>
				
										<label for="<?php bp_the_profile_field_input_name(); ?>"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ); ?><?php endif; ?></label>
										<input type="text" name="<?php bp_the_profile_field_input_name(); ?>" id="<?php bp_the_profile_field_input_name(); ?>" value="<?php bp_the_profile_field_edit_value(); ?>" <?php if ( bp_get_the_profile_field_is_required() ) : ?>aria-required="true"<?php endif; ?>/><?php

									endif;
				
									if ( 'textarea' == bp_get_the_profile_field_type() ) : ?>
				
										<label for="<?php bp_the_profile_field_input_name() ?>"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ); ?><?php endif; ?></label>
										<textarea rows="5" cols="40" name="<?php bp_the_profile_field_input_name(); ?>" id="<?php bp_the_profile_field_input_name(); ?>" <?php if ( bp_get_the_profile_field_is_required() ) : ?>aria-required="true"<?php endif; ?>><?php bp_the_profile_field_edit_value(); ?></textarea><?php

									endif; 
				
									if ( 'selectbox' == bp_get_the_profile_field_type() ) : ?>
				
										<label for="<?php bp_the_profile_field_input_name(); ?>"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ); ?><?php endif; ?></label>
										<select name="<?php bp_the_profile_field_input_name(); ?>" id="<?php bp_the_profile_field_input_name(); ?>" <?php if ( bp_get_the_profile_field_is_required() ) : ?>aria-required="true"<?php endif; ?>>

											<?php bp_the_profile_field_options() ?>

										</select><?php

									endif;

									if ( 'multiselectbox' == bp_get_the_profile_field_type() ) : ?>
				
										<label for="<?php bp_the_profile_field_input_name() ?>"><?php bp_the_profile_field_name() ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ); ?><?php endif; ?></label>
										<select name="<?php bp_the_profile_field_input_name() ?>" id="<?php bp_the_profile_field_input_name() ?>" multiple="multiple" <?php if ( bp_get_the_profile_field_is_required() ) : ?>aria-required="true"<?php endif; ?>>
					
											<?php bp_the_profile_field_options(); ?>
					
										</select><?php

										if ( !bp_get_the_profile_field_is_required() ) : ?>
					
											<a class="clear-value" href="javascript:clear( '<?php bp_the_profile_field_input_name(); ?>' );"><?php _e( 'Clear', 'buddypress' ); ?></a><?php
	
										endif;
				
									endif;

									if ( 'radio' == bp_get_the_profile_field_type() ) : ?>
				
										<div class="radio">

											<span class="label"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ); ?><?php endif; ?></span>
					
											<?php

												bp_the_profile_field_options();

												if ( !bp_get_the_profile_field_is_required() ) : ?>
						
													<a class="clear-value" href="javascript:clear( '<?php bp_the_profile_field_input_name(); ?>' );"><?php _e( 'Clear', 'buddypress' ); ?></a><?php

												endif;

											?>

										</div><?php

									endif;

									if ( 'checkbox' == bp_get_the_profile_field_type() ) : ?>
				
										<div class="checkbox">

											<span class="label"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ); ?><?php endif; ?></span>
					
											<?php bp_the_profile_field_options(); ?>

										</div><?php

									endif;

									if ( 'datebox' == bp_get_the_profile_field_type() ) : ?>
				
										<div class="datebox">
	
											<label for="<?php bp_the_profile_field_input_name(); ?>_day"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ); ?><?php endif; ?></label>
					
											<select name="<?php bp_the_profile_field_input_name(); ?>_day" id="<?php bp_the_profile_field_input_name(); ?>_day" <?php if ( bp_get_the_profile_field_is_required() ) : ?>aria-required="true"<?php endif; ?>>
					
												<?php bp_the_profile_field_options( 'type=day' ); ?>
					
											</select>
					
											<select name="<?php bp_the_profile_field_input_name() ?>_month" id="<?php bp_the_profile_field_input_name(); ?>_month" <?php if ( bp_get_the_profile_field_is_required() ) : ?>aria-required="true"<?php endif; ?>>
					
												<?php bp_the_profile_field_options( 'type=month' ); ?>
					
											</select>
					
											<select name="<?php bp_the_profile_field_input_name() ?>_year" id="<?php bp_the_profile_field_input_name(); ?>_year" <?php if ( bp_get_the_profile_field_is_required() ) : ?>aria-required="true"<?php endif; ?>>
					
												<?php bp_the_profile_field_options( 'type=year' ); ?>
					
											</select>
	
										</div><?php

									endif;

									do_action( 'bp_custom_profile_edit_fields' ); ?>
				
								<p class="description"><?php bp_the_profile_field_description(); ?></p>

							</div><?php

						endwhile;

						do_action( 'bp_after_profile_field_content' );

					?>
			
				<div class="submit"><input type="submit" name="profile-group-edit-submit" id="profile-group-edit-submit" value="<?php _e( 'Save Changes', 'buddypress' ); ?> " /></div>

				<div class="h20"><!-- --></div>

				<input type="hidden" name="field_ids" id="field_ids" value="<?php bp_the_profile_group_field_ids(); ?>" />
			
				<?php wp_nonce_field( 'bp_xprofile_edit' ); ?>
			
			</form><?php

		endwhile;

	endif;

	do_action( 'bp_after_profile_edit_content' );

?>